package com.zjcode.cdcer.mapper;

import com.zjcode.cdcer.model.CityEntity;
import com.zjcode.cdcer.model.SequenceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface SequenceMapper {

    //根据传入的code查询
    SequenceEntity getSequenceByCode(@Param("code") String code);

    void insert(SequenceEntity sequenceEntity);

    //编号清零
    void ResetCurrentNum(@Param("code") String code);

    //编号每次加1
    void increaseCurrentNum(@Param("CurrentNum") int CurrentNum,@Param("code") String code);

    List<CityEntity> getProvincesInfo(@Param("parentCode") String parentCode);
    List<CityEntity> getCityInfo(@Param("parentCode") String parentCode);
    List<CityEntity> getAreaInfo(@Param("parentCode") String parentCode);
    List<CityEntity> getStreetInfo(@Param("parentCode") String parentCode);
    List<CityEntity> getVillageInfo(@Param("parentCode") String parentCode);
    List<CityEntity> getVillages(@Param("areaCode") String areaCode);

    List<CityEntity> getStreets(@Param("cityCode") String cityCode);
    List<CityEntity> getProvincesInfoByName(@Param("parentCode") String parentCode,@Param("name") String name);
    List<CityEntity> getCityInfoByName(@Param("parentCode") String parentCode,@Param("name") String name);
    List<CityEntity> getAreaInfoByName(@Param("parentCode") String parentCode,@Param("name") String name);
    List<CityEntity> getStreetInfoByName(@Param("parentCode") String parentCode,@Param("name") String name);
    List<CityEntity> getVillageInfoByName(@Param("parentCode") String parentCode,@Param("name") String name);

    List<CityEntity> getAllProvincesInfo();
    List<CityEntity> getAllCityInfo();
    List<CityEntity> getAllCityInfoByAnHui();
    List<CityEntity> getAllAreaInfo();
    List<CityEntity> getAllAreaInfoByAnHui();
    List<CityEntity> getAllStreetInfo();
    List<CityEntity> getAllStreetInfoByAnHui();
    List<CityEntity> getAllVillageInfo();
    List<CityEntity> getAllVillageInfoByAnHui();


    String getProvincesInfoNameByCode(String code);
    String getAllCityInfoNameByCode(String code);
    String getAllAreaInfoNameByCode(String code);
    String getAllStreetInfoNameByCode(String code);
    String getAllVillageInfoNameByCode(String code);

    List<CityEntity> getVillagesByCodes(@Param("villageCodes") List<String> villageCodes);

    Map<String, Object> selByProvinceNameAndCityName(@Param("provinceName") String provinceName, @Param("cityName") String cityName);
}
